import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class test24 {

    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {


        Properties p=new Properties();
        FileInputStream  ss=new FileInputStream( new File("data.properties"));
        p.load(ss);
        ss.close();


        Class<?> forName = Class.forName("User");
        Object o = forName.newInstance();

        Method setUid = forName.getMethod("setUid", String.class);
        setUid.invoke(o,p.getProperty("uid"));

        Method setUsername = forName.getMethod("setUsername", String.class);
        setUsername.invoke(o,p.getProperty("username"));

        Method setPassword1 = forName.getMethod("setPassword", String.class);
        setPassword1.invoke(o,p.getProperty("password"));

        System.out.println(o);


    }
}
